package com.zb.entity.dto;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.zb.entity.ZjAdmAccount;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

/**
 * @Author WEN
 * @Date 2023/7/11 0011
 **/
@Data
@ApiModel("账号登录信息实体")
public class AccountLoginInfo {
    @ApiModelProperty(value = "主健ID")
    private Long id;

    @ApiModelProperty(value = "登录账号")
    private String account;

    @ApiModelProperty(value = "手机号")
    private String phone;

    @ApiModelProperty(value = "用户名称")
    private String name;

    @ApiModelProperty(value = "昵称")
    private String nickName;

    @ApiModelProperty(value = "头像")
    private String avatar;

    @ApiModelProperty(value = "状态：0-正常，1-冻结，2-封禁")
    private Integer status;

    @ApiModelProperty(value = "是否已更改了账号名：false-否，true-是")
    private Boolean updateAccount;

    @ApiModelProperty(value = "最新登录时间")
    private Date lastLoginTime;

    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @ApiModelProperty(value = "更新时间")
    private Date updateTime;

    public static AccountLoginInfo beanToInfo(ZjAdmAccount account) {
        AccountLoginInfo info = new AccountLoginInfo();
        info.setId(account.getId());
        info.setAccount(account.getAccount());
        info.setPhone(account.getPhone());
        info.setName(account.getName());
        info.setNickName(account.getNickName());
        info.setAvatar(account.getAvatar());
        info.setStatus(account.getStatus());
        info.setUpdateAccount(account.getUpdateAccount());
        info.setLastLoginTime(account.getLastLoginTime());
        info.setCreateTime(account.getGmtCreate());
        info.setUpdateAccount(account.getUpdateAccount());
        return info;
    }
}
